<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.AppConstant" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.CommonUtil" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.ContextUtil" %>
<%@ page import="java.util.List" %>
<%@ page import="com.wlcorp.forcazamis.domain.stock.StockProduct" %>
<%@ page import="com.wlcorp.forcazamis.domain.stock.StockProductDetail" %>
<%@ page import="com.wlcorp.forcazamis.domain.stock.Stock" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.Factory" %>
<%@ page import="com.wlcorp.forcazamis.domain.sample.SubSample" %>

<%
	Stock stock = (Stock) request.getAttribute("stock");
	List stockProductList = (List) request
			.getAttribute("stockProductList");
	List factoryList = (List) request.getAttribute("factoryList");
%>
<html>
<head>
	<title>合同基本信息</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/validator.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/script/calendartime.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/script/ajax.js"></script>
	<script type="text/javascript">
		function doSave(id,productId){
		    var frm="stockProductForm"+id;
		    var stockId=document.getElementById("stockId").value;
		    var spec="";
		    for (var i = 0; i < document.getElementsByName("checkedFlag"+id).length; i++) {
   			  if(document.getElementsByName("checkedFlag"+id)[i].checked){
   			 	 spec+=document.getElementsByName("checkedFlag"+id)[i].value;
   			  }
  	 		}
		    document.forms[frm].action="${pageContext.request.contextPath}/stock/stockManager.do?method=modifyStockProduct&stockId="+stockId+"&id="+id+"&productId="+productId+"&spec="+spec;
			document.forms[frm].submit();
		}
		
		function deleteRow(id,productId){
			var frm="stockProductForm"+id;
			var stockId=document.getElementById("stockId").value;
			if(confirm("确定删除？")){
				document.forms[frm].action="${pageContext.request.contextPath}/stock/stockManager.do?method=deleteStockProduct&productId="+productId+"&stockId="+stockId;
			    document.forms[frm].submit();
			}
			
		    
		}
		function baseInfoEdit(stockId){
			window.location = "${pageContext.request.contextPath}/stock/stockManager.do?method=getStock&stockId=" + stockId;
		}
		
		function addNewPiproduct(){
			var returnValue = window.showModalDialog("${pageContext.request.contextPath}/storagein/storageInManager.do?method=selectSubSampleListTop"
				,window,"dialogHeight:400px;dialogWidth:580px;center:yes;help:no;resizable:no;status:no;");
			
			if(returnValue && null != returnValue){
				var table = document.getElementById("piproductTbody");
				for(i = 0;i < returnValue.length;i++){
					appendRow(table,returnValue[i],'<%=AppConstant.PI_PRODUCT_IS_NEW%>');
				}
			}
		}
		
		function deleteRow1(tr){
			if(confirm("确定删除？")){
				var table = document.getElementById("piproductTbody");
				table.removeChild(tr);
			}
		}
		
        function getTotalPrice(tr){
        	
        	var totalPriceTxt = tr.cells[7].getElementsByTagName("input")[0];
        	var priceTxt = tr.cells[6].getElementsByTagName("input")[0];
        	var priceAddTxt = tr.cells[6].getElementsByTagName("input")[1];
        	var count = tr.cells[5].getElementsByTagName("input")[0];
        	totalPriceTxt.value = (parseFloat(priceTxt.value) + parseFloat(priceAddTxt.value)) * parseFloat(count.value);
        }
        
        function doSubmitConfirm(){
        	
			var sUrl = "${pageContext.request.contextPath}/confirm/confirmManager.do?method=submitConfirm"
				+ "&confirmType=<%=AppConstant.CONFIRM_TYPE_IN_STORAGE%>&itemId=${storageIn.storageInId}";
			ajaxRead(sUrl,function(obj){
				var result = obj.responseText;
				alert(result);
				document.getElementById("submitConfirmBtn").disabled = true;
			});
		}
		
		function selectNewPiproduct(customerId){
			var returnValue = window.showModalDialog("${pageContext.request.contextPath}/pi/pidetailManager.do?method=selectPiProductTop&customerId=" + customerId
				,window,"dialogHeight:400px;dialogWidth:680px;center:yes;help:no;resizable:no;status:no;");
			
			if(returnValue && null != returnValue){
				var table = document.getElementById("piproductTbody");
				for(i = 0;i < returnValue.length;i++){
					appendRowRe(table,returnValue[i],'<%=AppConstant.PI_PRODUCT_IS_OLD%>');
				}
			}
		}
		
        function showDetail(productId){
        	var tr = document.getElementById(productId);
        	if(tr){
	        	if(tr.style.visibility == "visible"){
	        		tr.style.visibility = "hidden";
	        		tr.style.display = "none";
	        	}else{
	        		tr.style.visibility = "visible";
	        		tr.style.display = "";
	        	}
        	}
        }
        
        function printStock(stockId){
			window.open("${pageContext.request.contextPath}/stock/stockManager.do?method=printStock&stockId=" + stockId);
		}
		
	    function uploadProductImage(){
        //	 var sUrl = "${pageContext.request.contextPath}/stock/stockManager.do?method=uploadProductImage";
		//	 ajaxRead(sUrl,function(obj){
		//		var result = obj.responseText;
			//	alert(result);
				//document.getElementById("save").disabled = true;
		//	});
		}
		
		//保存产品明细子类，//包括新增和修改
		function saveStockProductDetail(id,row){
			var frm="stockProductForm"+id;
			var product="productId"+id;
			var productId =document.getElementById(product).value;
			var stockId=document.getElementById("stockId").value;
			if(productId.length < 1){
				alert("请先保存产品信息！");
				return;
			}
			var productDetailId = row.id;
			//if("newRow" == productDetailId){
			//	productDetailId = "";
			//}
			var sUrl = "${pageContext.request.contextPath}/stock/stockManager.do?method=modifyStockProductDetail&productId=" + productId
				+ "&productDetailId=" + productDetailId+ "&stockId=" + stockId+ "&id=" + id;
			var params = "";
			var cells = row.cells;
			for(i = 0;i < cells.length;i++){
				var input = cells[i].getElementsByTagName("input");
				if(input.length > 0){
				
					//验证必须输入的字段
					if("letteringCode" == input[0].name && input[0].value.length < 1){
						alert("请输入印字型号！");
						return;
					}
					if("letteringColor" == input[0].name && input[0].value.length < 1){
						alert("请输入印字颜色！");
						return;
					}
					//if("piColor" == input[0].name && input[0].value.length < 1){
					//	alert("请输入颜色(PI)！");
					//	return;
					//}
					//if("shelfSurefaceColor" == input[0].name && input[0].value.length < 1){
					//	alert("请输入架面颜色！");
					//	return;
					//}
					if("letteringSize" == input[0].name && input[0].value.length < 1){
						alert("请输入印字尺寸！");
						return;
					}
					//if("shelfSurefaceColor" == input[0].name && input[0].value.length < 1){
					//	alert("请输入架面颜色！");
					//	return;
					//}
					//if("shelfCruraColor" == input[0].name && input[0].value.length < 1){
					//	alert("请输入镜腿颜色！");
					//	return;
					//}
					if("amount" == input[0].name && input[0].value.length < 1){
						alert("请输入数量！");
						return;
					}
					params = params + "&" + input[0].name + "=" + encodeURI(input[0].value);
				}
			}
			sUrl = sUrl + params;
			ajaxRead(sUrl,function(obj){
				var response = obj.responseText;
				if("" != response){
				//	row.id = response;
				//row.cells[row.cells.length-1].innerHTML=response;
					//row.cells[row.cells.length - 1].innerHTML = '<a href="javascript:saveStockProductDetail(1,document.getElementById(' + response + '))">保存</a>';
					alert("保存成功！");
				}else{
					alert("保存失败！");
				}
			});
		}
		
		function callback(msg){
			document.getElementById("file").outerHTML = document.getElementById("file").outerHTML;
			document.getElementById("msg").innerHTML = "<font color=red>"+msg+"</font>";
		}
		
		function deleteImage(productId){
			var stockId=document.getElementById("stockId").value;
        	if(confirm("确定删除？")){
        		window.location = "${pageContext.request.contextPath}/stock/stockManager.do?method=deleteProductImage&productId="+ productId+"&stockId="+stockId;
        	}
        }
	</script>
</head>
<body>
<center>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="30">
	<tr> 
	  <td width="22" class="page_titlebar_head">&nbsp;</td>
	  <td class="page_titlebar_bg" width="981">采购合同细节</td>
	</tr>
</table>

<table width="90%" cellspacing="0" cellpadding="0" border="0">
  <tr> 
   	<td align="right"/>
  </tr>
  <tr> 
   	<td align="right"> 
      	<input class="button_common" type="button" name="print" value="合同打印档" style="font-size:9pt" onClick="javascript:printStock('<%=stock.getStockId()%>')"> 
    </td>
  </tr>
</table>

<table width="90%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
  <tr> 
    <td colspan="6" class="table_unfold_titlebar_small_bg">&nbsp;&nbsp;<b>合同基本信息</b></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="15%">合同编号：</td>
		<td width="17%">${stock.stockCode}
		</td>
		 <td class="table_label" width="15%">供应商编号：</td>
		 <td width="17%">${stock.factory.factoryCode}
		</td>
		 <td class="table_label" width="15%">供应商名称：</td>
		 <td width="17%">${stock.factory.factoryFullName}
		</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="15%">下单日期：</td>
		<td width="17%">${stock.stockDate}
		</td>
		 <td class="table_label" width="15%">交货日期：</td>
		 <td width="17%">${stock.deliveryDate}
		</td>
		 <td class="table_label" width="15%">&nbsp;</td>
		 <td width="17%">&nbsp;</td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="15%" id="memo_TEXT">备注信息：</td>
		<td width="80%" colspan="5">${stock.memo}
		</td>
  </tr>
  <tr class="InputFrameLine">
  	<td width="100%" colspan="6" align="center"><input type="button" class="button_common_5" name="baseInfoButton" value="基本信息编辑" onClick="javascript:baseInfoEdit('${stock.stockId}')"/>
  	<td>
  </tr>
</table>

<input type="hidden" name="stockId" value="${stock.stockId}"/>
<input type="hidden" name="status"/>
<input type="hidden" name="frame" value=""/>
<table id="" width="90%" border="0" cellspacing="1" cellpadding="0" bgcolor="#999999">
	  <tbody id="piproductTbody">
      <tr bgcolor="#E7E7E7">
      	<td width="3%" align="center"></td>
      	<td width="8%" align="center">我司型号</td>
      	<td align="center" colspan="3">镜腿</td>
      	<td width="10%" align="center">订单尺寸</td>
        <td width="10%" align="center">客户货号</td>
        <td width="10%" align="center">客户品牌</td>
        <td width="10%" align="center" colspan="3">动作</td>
      </tr>
      <%
      		if (null != stockProductList) {
      			for (int i = 0; i < stockProductList.size(); i++) {
      				StockProduct stockProduct = (StockProduct) stockProductList.get(i);
      %>
     
     <input type="hidden" name="productId<%=i%>" value="<%=stockProduct.getProductId()%>"/>
      <tr bgcolor="#ffffff">
      	<td align="center"><%=i + 1%></td>
      	<td><b><%=CommonUtil.nullToStr(stockProduct.getMyCode())%></b></td>
      	<td colspan="3"><%=CommonUtil.nullToStr(stockProduct.getShelfCrura())%></td>
      	<td><%=CommonUtil.nullToStr(stockProduct.getOrderSize())%></td>
      	<td><%=CommonUtil.nullToStr(stockProduct.getCustomerOrderCode())%></td>
      	<td><%=CommonUtil.nullToStr(stockProduct.getCustomerBrand())%></td>
       
        <td colspan="3" align="center">
        <%
           if (null !=stock.getState()&& AppConstant.BILL_STATE_PRE_CONFIRM == stock.getState()|| AppConstant.BILL_STATE_CONFIRMED == stock.getState()|| AppConstant.BILL_STATE_CONFIRMING == stock.getState()) {
        %>
        	<a href="javascript:showDetail('<%=stockProduct.getProductId()%>_DETAIL');"><font color="blue">查看</font></a>
        <%
        }
        %>
        <%
           if (null == stock.getState()|| AppConstant.BILL_STATE_DRAWBACK == stock.getState()|| AppConstant.BILL_STATE_SUBMITED == stock.getState()) {
        %>
        	<a href="javascript:showDetail('<%=stockProduct.getProductId()%>_DETAIL');"><font color="blue">编辑</font></a>
			<a href="javascript:deleteRow('<%=i%>','<%=stockProduct.getProductId()%>')">删除</a>
			<%
        }
        %>
		</td>
	  </tr>
	  
	  <tr  bgcolor="#E7E7E7" id="<%=stockProduct.getProductId()%>_DETAIL" style="visibility:hidden;display:none;">
	  	<td colspan="12">
			<table width="100%" bgcolor="#E7E7E7" cellspacing="0" cellpadding="0" border="0" height="100%">
			
			<form name="stockProductForm<%=i%>" method="POST">
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">我司型号：</td>
					<td width="13%"><input type="text" class="input" name="myCode<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getMyCode())%>"
						disabled="true" /></td>
					<td class="table_label" width="13%">工厂型号：</td>
					<td width="13%" colspan="9"><input type="text" class="input" name="factoryCode<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getFactoryCode())%>" /></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">附图尺寸：</td>
					<td width="13%"><input type="text" class="input" name="figureSize<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getFigureSize())%>" /></td>
					<td class="table_label" width="13%">订单尺寸：</td>
					<td width="13%"><input type="text" class="input" name="orderSize<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getOrderSize())%>" /></td>
					<td class="table_label" width="13%">客户品牌：</td>
					<td width="28%"><input type="text" class="input" name="customerBrand<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getCustomerBrand())%>" /></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">窗形更改：</td>
					<td width="13%"><input type="text" class="input" name="windowChange<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getWindowChange())%>" /></td>
					<td class="table_label" width="13%">鼻梁更改：</td>
					<td width="13%"><input type="text" class="input" name="noseChange<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getNoseChange())%>" /></td>
					<td class="table_label" width="13%">生产档次：</td>
					<td width="28%"><input type="text" class="input" name="level<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getLevel())%>" /></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">镜腿长度：</td>
					<td width="13%"><input type="text" class="input" name="shelfCruraLength<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getShelfCruraLength())%>" /></td>
					<td class="table_label" width="13%">镜腿宽度：</td>
					<td width="13%"><input type="text" class="input" name="shelfCruraWidth<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getShelfCruraWidth())%>" /></td>
					<td class="table_label" width="13%">镜架类型：</td>
					<td width="28%">
					<input type="radio" name="frameType<%=i%>" value="<%=AppConstant.STOCK_PRODUCT_FRAME_METAL%>"
						<%if(stockProduct.getFrameType().equals(AppConstant.STOCK_PRODUCT_FRAME_METAL)){%> checked <%}%> />金属架&nbsp; 
					<input type="radio" name="frameType<%=i%>" value="<%=AppConstant.STOCK_PRODUCT_FRAME_BOARD%>"
						<%if(stockProduct.getFrameType().equals(AppConstant.STOCK_PRODUCT_FRAME_BOARD)){out.print("checked");}%> />板材架&nbsp;
					</td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">鼻托：</td>
					<td width="13%"><input type="text" class="input" name="ectorhinal<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getEctorhinal())%>" /></td>
					<td class="table_label" width="13%">脚套形状：</td>
					<td width="13%"><input type="text" class="input" name="cover<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getCover())%>" /></td>
					<td class="table_label" width="13%">装头弧度：</td>
					<td width="13%"><input type="text" class="input" name="headRadian<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getHeadRadian())%>" /></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">装头长度：</td>
					<td width="13%"><input type="text" class="input" name="headLength<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getHeadLength())%>" /></td>
					<td class="table_label" width="13%">窗丝：</td>
					<td width="13%"><input type="text" class="input" name="windowSilk<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getWindowSilk())%>" /></td>
					<td class="table_label" width="13%">镜腿、窗丝臼螺丝：</td>
					<td width="13%"><input type="text" class="input" name="crura<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getCrura())%>" /></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">镜架斜度：</td>
					<td width="13%"><input type="text" class="input" name="framePitch<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getFramePitch())%>" /></td>
					<td class="table_label" width="13%">镜架弯度：</td>
					<td width="13%"><input type="text" class="input" name="frameCrankle<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getFrameCrankle())%>" /></td>
					<td class="table_label" width="13%"></td>
					<td width="13%"></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">镜腿描述：</td>
					<td width="13%" colspan="8"><input type="text" class="input" name="shelfCrura<%=i%>" value="<%=CommonUtil.nullToStr(stockProduct.getShelfCrura())%>" size="100" maxlength="500" /></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">头部说明：</td>
					<td width="13%" colspan="8">
					<textarea name="headExplain<%=i%>" cols="60" rows="3" style="width: 90%" wrap="hard"><%=CommonUtil.nullToStr(stockProduct.getHeadExplain())%></textarea>
					</td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">产品说明：</td>
					<td width="13%" colspan="8">
					<textarea name="productExplain<%=i%>" cols="60" rows="4" style="width: 90%" wrap="hard"><%=CommonUtil.nullToStr(stockProduct.getProductExplain())%></textarea></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2">注意事项：</td>
					<td width="13%" colspan="8"><textarea name="notice<%=i%>" cols="60" rows="4" style="width: 90%" wrap="hard"><%=CommonUtil.nullToStr(stockProduct.getNotice())%></textarea></td>
				</tr>
				<tr class="InputFrameLine">
					<td class="table_label" width="11%" colspan="2"></td>
					<td width="13%" colspan="8">
					  <p>
					    <input type="checkbox" name="checkedFlag<%=i%>" value="F" <%if(null!=stockProduct.getSpecialize()&&stockProduct.getSpecialize().contains(new String("F"))){out.print("checked");}%>/>
					    &nbsp;<font color="blue"><b>该款有新配件，请注意</b></font>&nbsp;&nbsp;
					    <input type="checkbox" name="checkedFlag<%=i%>" value="C" <%if(null!=stockProduct.getSpecialize()&&stockProduct.getSpecialize().contains(new String("C"))){out.print("checked");}%>/>
					    &nbsp;<font color="blue"><b>该款有新颜色，请注意</b></font>&nbsp;&nbsp; 
					    <input type="checkbox" name="checkedFlag<%=i%>" value="S" <%if(null!=stockProduct.getSpecialize()&&stockProduct.getSpecialize().contains(new String("S"))){out.print("checked");}%>/>
				    &nbsp;<font color="blue"><b>该款为新结构，请注意</b></font>&nbsp;&nbsp;</p>
				    </td>
				</tr>
				</form>
				
				<tr>
					<td colspan="10">
					<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#999999">
						<tbody id="subSampleTbody">
							<tr bgcolor="#E7E7E7">
								<td width="8%" align="center">印字型号</td>
								<td width="10%" align="center">印字颜色</td>
								<td width="10%" align="center">印字尺寸</td>
								<td width="10%" align="center"><%if(CommonUtil.nullToStr(stockProduct.getMyCode()).endsWith("B")||CommonUtil.nullToStr(stockProduct.getMyCode()).endsWith("Z")) {out.print("架面颜色");}else{out.print("电镀颜色");}%></td>
								<td width="10%" align="center"><%if(CommonUtil.nullToStr(stockProduct.getMyCode()).endsWith("B")||CommonUtil.nullToStr(stockProduct.getMyCode()).endsWith("Z")) {out.print("镜腿颜色");}else{out.print("脚套颜色");}%></td>
								<td width="10%" align="center">数量</td>
								<td width="10%" align="center">单价</td>
								<td width="10%" align="center">电镀厂</td>
								<td width="10%" align="center">备注</td>
								<td align="center">动作</td>
							</tr>
							<%
								if (null != stockProduct.getStockProductDetailSet()&& stockProduct.getStockProductDetailSet().size() > 0) {
									for (Iterator iter = stockProduct.getStockProductDetailSet().iterator(); iter.hasNext();) {
										StockProductDetail stockProductDetail = (StockProductDetail) iter.next();
										if (stockProductDetail.isDeleteFlag() == true) {
											continue;
										}
							%>

							<tr id="<%=stockProductDetail.getProductDetailId()%>" bgcolor="#ffffff">
							    <td><input name="letteringCode" type="text" class="input" value="<%=CommonUtil.nullToStr(stockProductDetail.getLetteringCode())%>" size="12" maxlength="10"></td>
								<td><input class="input" type="text" name="letteringColor" value="<%=CommonUtil.nullToStr(stockProductDetail.getLetteringColor())%>" size="15" maxlength="20"/></td>
								<td><input class="input" type="text" name="letteringSize" value="<%=CommonUtil.nullToStr(stockProductDetail.getLetteringSize())%>" size="15" maxlength="20"/></td>
								<td><input class="input" type="text" name="shelfSurefaceColor" value="<%=CommonUtil.nullToStr(stockProductDetail.getShelfSurefaceColor())%>" size="15" maxlength="20"/></td>
								<td><input class="input" type="text" name="shelfCruraColor" value="<%=CommonUtil.nullToStr(stockProductDetail.getShelfCruraColor())%>" size="15" maxlength="20"/></td>
								<td><input class="input" type="text" name="amount" value="<%=CommonUtil.nullToStr(stockProductDetail.getAmount())%>" size="15" maxlength="20"/></td>
								<td><input class="input" type="text" name="unitPrice" value="<%=CommonUtil.format2Scale(stockProductDetail.getUnitPrice())%>" size="15" maxlength="20"/></td>
								<td><input class="input" type="text" name="platingFactoryName" value="<%=CommonUtil.nullToStr(stockProductDetail.getPlatingFactoryName())%>" size="20" maxlength="20"/></td>
								<td><input class="input" type="text" name="memo" value="<%=CommonUtil.nullToStr(stockProductDetail.getMemo())%>" size="20" maxlength="200" /></td>
								<td align="center">
								<%
          					 		if (null == stock.getState()|| AppConstant.BILL_STATE_DRAWBACK == stock.getState()|| AppConstant.BILL_STATE_SUBMITED == stock.getState()) {
        						%>
									<a href="javascript:saveStockProductDetail(<%=i%>,document.getElementById('<%=stockProductDetail.getProductDetailId()%>'))">保存</a>
								<%
          					 		}
								%>
								</td>
							</tr>
							 <%
							   }
							  }
							 %>
							 
							 
							<form action="upload.jsp?productId=<%=stockProduct.getProductId()%>" id="form1" name="form1" encType="multipart/form-data"  method="post" target="hidden_frame" >
							
							<%
		       					if(null != stockProduct.getProductImage()&&!stockProduct.getProductImage().equals("")){%>
							<tr class="InputFrameLine">
							    <td width="20%" align="right" colspan="3">
							    <%
          					 		if (null == stock.getState()|| AppConstant.BILL_STATE_DRAWBACK == stock.getState()|| AppConstant.BILL_STATE_SUBMITED == stock.getState()) {
        						%>
		        					<a href="javascript:deleteImage(<%=stockProduct.getProductId()%>);">删除</a>
		        				<%
          					 		}
		        				%>
		        				</td>
		       					<td width="80%" colspan="10" align="left">
		        					<img width="700px" src="${pageContext.request.contextPath}<%=stockProduct.getProductImage()%>"/>		        				</td>
		  					</tr>
		  					<%}%>
		  					
		  					<%
          					 		if (null == stock.getState()|| AppConstant.BILL_STATE_DRAWBACK == stock.getState()|| AppConstant.BILL_STATE_SUBMITED == stock.getState()) {
        					%>
		  					<tr class="InputFrameLine">
		        				<td colspan="12" align="center">
		        					产品附图：
		        					  <input name="file" type="file" class="input"/>(图片尺寸标准：宽：700象素，高度不限,图片格式为jpg,gif,bmp)
	        				  </td>
		  					</tr>
		  					<tr class="InputFrameLine">
		        				<td colspan="12" align="center">
		        					<span id="msg"></span>
	        				  </td>
		  					</tr>
		  					<tr class="InputFrameLine">
  								<td colspan="12" align="center"> 
  									<input type="submit" class="button_common" name="saveImageButton" value="上传图片">
							   </td>
  							</tr>
  							<iframe name='hidden_frame' id="hidden_frame" style='display:none'></iframe>
							</form>
		  					 
	  						<tr bgcolor="#ffffff">
        						<td colspan="12" align="right">
        						<input class=button_save type=button name=save value="      保存" style="font-size:9pt" onClick="javascript:doSave('<%=i%>','<%=stockProduct.getProductId() %>')" id="btn_submit">
        						&nbsp;
        						<input class=button_reset name=reset type=reset value="      恢复" style="font-size:9pt" id="btn_reset">
        						</td>
      						</tr>
	 						 <%
	 							 }
							 %>
							<!-- tr id="newRow" bgcolor="#ffffff">
								<td><input name="barCode" type="text" class="input" value="" size="10"></td>
								<td><input class="input" type="text" name="size" value=" " size="5" maxlength="20"/></td>
								<td><input class="input" type="text" name="plateColor" value=" " size="5" maxlength="20"/></td>
								<td><input class="input" type="text" name="ecolorDesc" value=" " size="5" maxlength="20"/></td>
								<td><input class="input" type="text" name="ccolorDesc" value=" " size="5" maxlength="20"/></td>
								<td><input class="input" type="text" name="ccolorDesc" value=" " size="5" maxlength="20"/></td>
								<td><input class="input" type="text" name="ccolorDesc" value=" " size="5" maxlength="20"/></td>
								<td><input class="input" type="text" name="ccolorDesc" value=" " size="5" maxlength="20"/></td>
								<td><input class="input" type="text" name="ccolorDesc" value=" " size="5" maxlength="20"/></td>
								<td><input class="input" type="text" name="memo" value=" " size="10" maxlength="200" /></td>
								<td colspan="2"><a href="javascript:saveSubSample(document.getElementById('newRow'))">保存</a></td>
							</tr>
							<tr bgcolor="#ffffff">
								<td colspan="12" align="center"><input type="button" name="addnewSubSample_button" value="新增产品子类"
									onclick="addNewSubSample()" /></td>
							</tr  -->
						</tbody>
					</table>
					<td>
				<tr>
				 
			</table>
		</td>
  	  </tr>
	 
	  <%
	  	}
	  	}
	  %>
	 
	  </tbody>
</table>

<center>
${message}
</body>
</html>